EWS Managed API: "One or more subscriptions in the request reside on another Client Access server. GetStreamingEvents won't proxy in the event of a batch request."

Using streaming subscriptions in Exchange Online cloud. I group subscriptions into shared connections by groupinfo from Autodiscover. To create a new group I start with the service impersonating Anchor user. Then I set anchor header and prefer affinity header. I retain the service instance for creating the connection and all subsequent subscriptions in this group because it has the backend override response cookie.

Periodically I get an error on a subscription:

Unable to retrieve events for this subscription.  The subscription must be recreated.

We have code written to handle this. It immediately looks up the subscriber's group info in autodiscover and creates a new subscription by the same rules above.  I have verified the groupinfo coming back is a different value than the first subscription. I do not have the exact location of the failure, but I believe I have it isolated to this code:

subscriptionSet.Subscription = Service.SubscribeToStreamingNotifications(folders, EventType.Created);
Connection = new StreamingSubscriptionConnection(Service, 30);
 Connection.OnDisconnect += new StreamingSubscriptionConnection.SubscriptionErrorDelegate(Connection_OnDisconnect);
 Connection.OnNotificationEvent += new StreamingSubscriptionConnection.NotificationEventDelegate(Connection_OnNotificationEvent);
 Connection.OnSubscriptionError += new StreamingSubscriptionConnection.SubscriptionErrorDelegate(Connection_OnSubscriptionError);
Connection.AddSubscription(subscriptionSet.Subscription);

Somewhere in that code the following exception is being thrown:

One or more subscriptions in the request reside on another Client Access server. GetStreamingEvents won't proxy in the event of a batch request.

When I restart the same subscriber manually with the same groupinfo, it works minutes later. But during the moments after the error, when I go to create the subscription it fails.  I do not know which line is throwing this exception, but I can't reproduce it. I will have more instrumentation the next time it happens, but for now this is all I have.

What I'm wondering is if these events in the cloud -- specifically, the ones that cause me to have to create a new subscription -- I'm wondering if maybe some replication must occur to establish the resource on the new CAS/or mailbox server, and if by reconnecting immediately I am not allowing this replication to get everywhere it needs to be.

Other than that I am out of ideas, because I know the groupinfo I'm using will be good in a few minutes, so I doubt it's that.

And since we're here, does anyone know which of those statements might be throwing this error? Maybe I could just put a catch to suppress this particular error and move on.

Thanks in advance.

June 10th, 2015 6:49pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics